﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BestLifePOS_Core.Data.Commands;
using BestLifePOS_Core.DomainObjects;
using BestLifePOS_Core.Data.Fascade;
using System.Linq;

namespace BestLifePOS_PresentationLayer
{
    public partial class frmDiscounts : Form
    {
        public frmDiscounts()
        {
            InitializeComponent();
        }

        private void frmDiscounts_Load(object sender, EventArgs e)
        {
            ItemFillGrid();
        }


        private void ItemFillGrid()
        {

            //Fill the DataGrid
            //Purchase_Order LvPO = new Purchase_Order();
            //LvPR.status = "APPROVED";
            List<Product> LvList = ProductDAO.GetAllProduct();

            DataTable LvTable = new DataTable();
            dgvItem.DataSource = LvTable;

            LvTable.Columns.Add("POID ");
            LvTable.Columns.Add("BranchID ");
            LvTable.Columns.Add("SupID ");
            LvTable.Columns.Add("PODate ");


            foreach (Product LvProducts in LvList)
            {
                LvTable = (DataTable)dgvItem.DataSource;

                LvTable.Rows.Add(LvTable.NewRow());

                LvTable.Rows[LvTable.Rows.Count - 1][0] = LvProducts.Po_Id.ToString();
                LvTable.Rows[LvTable.Rows.Count - 1][1] = LvProducts.Branch_Id.ToString();
                LvTable.Rows[LvTable.Rows.Count - 1][2] = LvProducts.Sup_Id.ToString();
                LvTable.Rows[LvTable.Rows.Count - 1][3] = LvProducts.Po_Date.ToString();



            }
        }
    }
}
